import { BrowserRouter, Route, Routes, Navigate } from "react-router-dom";
import Layout from "./pages/Layout";
import Home from "./pages/home";
import About from "./pages/about";
import HomeList from "./pages/home/list";
import ErrorPage from "./pages/error";

const App = () => {
    return (
        <BrowserRouter>
            <Routes>
                <Route path='/' element={<Layout />}>
                    <Route path='/' element={<Navigate to='/home' replace />} />
                    <Route path='/home' element={<Home />}>
                        <Route
                            index
                            element={<Navigate to='/home/list' replace />}
                        />
                        <Route path='list' element={<HomeList />}>
                            <Route
                                path=':id'
                                element={
                                    <div className='alert alert-danger'>
                                        详情
                                    </div>
                                }
                            ></Route>
                        </Route>
                    </Route>
                    <Route path='/about' element={<About />} />
                </Route>
                <Route path='*' element={<ErrorPage />} />
            </Routes>
        </BrowserRouter>
    );
};

export default App;
